#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;

struct ListNode {
    int val;
    struct ListNode* next;
};


bool hasCycle(struct ListNode* head) {
    struct ListNode* slow = head;
    struct ListNode* fast = head;
    if (head == NULL)
        return false;
    while ((fast->next) && (fast->next->next))
    {
        fast = fast->next->next;
        slow = slow->next;
        if (slow == fast)
        {
            return true;
        }
    }
    return false;
}


int main()
{
    
    return 0;
}
